public class test1 {
    /**
     * Definition for singly-linked list.
     * public class ListNode {
     *     int val;
     *     ListNode next;
     *     ListNode() {}
     *     ListNode(int val) { this.val = val; }
     *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
     * }
     */
    class Solution {
        public ListNode deleteDuplicates(ListNode head) {
            ListNode dummyNode = new ListNode(-1,head);
            ListNode cur = dummyNode;
            while(cur.next!=null && cur.next.next!=null){
                int val = cur.next.val;
                if(cur.next.next.val==val){
                    while(cur.next!=null && cur.next.val==val){
                        //不断更新cur.next
                        cur.next = cur.next.next;
                    }
                }else{
                    cur = cur.next;
                }
            }
            return dummyNode.next;
        }
    }
}
